<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li ><a href="{:url('Gift/index')}">列表</a></li>
			<li class="active"><a >{:lang('EDIT')}</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('Gift/editPost')}">
            <div class="form-group">
				<label for="input-type" class="col-sm-2 control-label"><span class="form-required">*</span>类型</label>
				<div class="col-md-6 col-sm-10">
                    <volist name="type" id="v">
					<label class="radio-inline"><input type="radio" name="type" value="{$key}" <if condition="$key eq $data['type']">checked</if>>{$v}</label>
                    </volist>
				</div>
			</div>
            
            <div class="form-group">
				<label for="input-name" class="col-sm-2 control-label"><span class="form-required">*</span>名称</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="input-name" name="name" value="{$data['name']}">
				</div>
			</div>
            
            <div class="form-group">
				<label for="input-needcoin" class="col-sm-2 control-label"><span class="form-required">*</span>价格</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="input-needcoin" name="needcoin" value="{$data['needcoin']}" onkeyup="this.value=this.value.replace(/[^\d-]/g,'')" />
				</div>
			</div>
            
            <div class="form-group">
				<label for="input-user_login" class="col-sm-2 control-label"><span class="form-required">*</span>图片</label>
				<div class="col-md-6 col-sm-10">
					<input type="hidden" name="thumb" id="thumbnail" value="{$data['thumb']}">
                    <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
                        <if condition="empty($data.thumb)">
                        <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                 id="thumbnail-preview"
                                 style="cursor: pointer;max-width:100px;max-height:100px;"/>
                        <else/>
                        <img src="{:cmf_get_image_preview_url($data.thumb)}"
                             id="thumbnail-preview"
                             style="cursor: pointer;max-width:100px;max-height:100px;"/>
                        </if>
                    </a>
                    <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片"> 建议尺寸： 200 X 200
				</div>
			</div>
            
            <div class="form-group">
				<label for="input-swftype" class="col-sm-2 control-label"><span class="form-required">*</span>动画类型</label>
				<div class="col-md-6 col-sm-10" id="swftype">
                    <volist name="swftype" id="v">
					<label class="radio-inline"><input type="radio" name="swftype" value="{$key}" <if condition="$key eq $data['swftype']">checked</if>>{$v}</label>
                    </volist>
				</div>
			</div>
            
            <div class="form-group" id="">
				<label for="input-gif" class="col-sm-2 control-label"><span class="form-required">*</span>GIF图片</label>
				<div class="col-md-6 col-sm-10">
                    <div id="swftype_bd_0" <if condition="$data['swftype'] eq '1'">style="display:none;"</if>>
                        <input type="hidden" name="gif" id="thumbnail2" value="{$data['swf']}">
                        <a href="javascript:uploadOneImage('图片上传','#thumbnail2');">
                            <if condition="empty($data.swf) || $data['swftype'] eq '1'">
                            <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                     id="thumbnail2-preview"
                                     style="cursor: pointer;max-width:100px;max-height:100px;"/>
                            <else/>
                            <img src="{:cmf_get_image_preview_url($data.swf)}"
                                 id="thumbnail2-preview"
                                 style="cursor: pointer;max-width:100px;max-height:100px;"/>
                            </if>
                        </a>
                        <input type="button" class="btn btn-sm btn-cancel-thumbnail2" value="取消图片"> 建议尺寸： 200 X 200
                    </div>
                    <div id="swftype_bd_1" <if condition="$data['swftype'] eq '0'">style="display:none;"</if>>
                        <input class="form-control" id="js-file-input" type="text" name="svga" value="{$data['swf']}" style="width: 300px;display: inline-block;" title="文件名称">
                        <a href="javascript:uploadOne('文件上传','#js-file-input','file');">上传SVGA文件</a>
                    </div>
                    
				</div>
			</div>
            
            <div class="form-group">
				<label for="input-swftime" class="col-sm-2 control-label"><span class="form-required">*</span>动画时长</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="input-swftime" name="swftime" value="{$data['swftime']}">秒 精度：小数点后两位
				</div>
			</div>
            

            <div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<input type="hidden" name="id" value="{$data.id}" />
					<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('EDIT')}</button>
					<a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
				</div>
			</div>

		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
    <script type="text/javascript">
        (function(){
            $('.btn-cancel-thumbnail').click(function () {
                $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
                $('#thumbnail').val('');
            });
            
            $('.btn-cancel-thumbnail2').click(function () {
                $('#thumbnail2-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
                $('#thumbnail2').val('');
            });
            $("#swftype label").on('click',function(){
                var v=$("input",this).val();
                var b=$("#swftype_bd_"+v);
                b.siblings().hide();
                b.show();
            })
        })()

    </script>
</body>
</html>